using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace WMS_Goodsinfo.Infastructure
{
    public class ProductDbContextFactory : IDesignTimeDbContextFactory<ProductDbContext>
    {
        public ProductDbContext CreateDbContext(string[] args)
        {
            var optionsBuilder = new DbContextOptionsBuilder<ProductDbContext>();
            
            // 使用SQL Server连接字符串
            // 使用与appsettings.json相同的数据库配置
            optionsBuilder.UseSqlServer("server=123.56.75.137;uid=sa;pwd=q1w2e3r4...;database=AuthCenter;Encrypt=True;TrustServerCertificate=True;");
            
            return new ProductDbContext(optionsBuilder.Options);
        }
    }
} 